<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="房源标题" class="movement">
          <el-input
            v-model="formInline.housing_source_title"
            placeholder="请输入房源标题"
          ></el-input>
        </el-form-item>
        <el-form-item label="姓名" class="movement">
          <el-input
            v-model="formInline.name"
            placeholder="请输入姓名"
          ></el-input>
        </el-form-item>
        <el-form-item label="电话" class="movement">
          <el-input
            v-model="formInline.phone"
            placeholder="请输入电话"
          ></el-input>
        </el-form-item>
        <el-form-item label="类型" class="movement">
          <el-select v-model="formInline.type" placeholder="请选择">
            <el-option
              v-for="item in optionsType"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="状态" class="movement">
          <el-select v-model="state" placeholder="请选择" @change="stateChange">
            <el-option
              v-for="item in optionsStatus"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="search()" class="movement"
            >查询</el-button
          >
          <el-button type="primary" @click="resert()" class="movement"
            >重置</el-button
          >
          <!-- <el-button type="primary" @click="addGongZhongs()"
            >新增工种</el-button
          > -->
        </el-form-item>
      </el-form>
      <!-- <el-button type="primary" class="divMia" @click="newly"
        >新增分店</el-button
      > -->
    </div>
    <div class="text item">
      <el-tabs type="border-card" @tab-click="handleClick">
        <el-tab-pane>
          <span label="业主" slot="label">业主 </span>
        </el-tab-pane>
        <el-tab-pane>
          <span label="经纪人" slot="label">经纪人 </span>
        </el-tab-pane>
        <el-table
          v-loading="loading"
          :data="tableData"
          border
          style="width: 100%"
          max-height="600"
        >
          <el-table-column label="ID" align="center" prop="id" width="70">
          </el-table-column>
          <el-table-column
            prop="housing_source_title"
            align="center"
            label="房源标题"
          >
          </el-table-column>

          <el-table-column prop="name" align="center" label="姓名">
          </el-table-column>
          <el-table-column prop="phone" align="center" label="电话">
          </el-table-column>
          <el-table-column prop="ctime" align="center" label="角色">
            <template slot-scope="scope">
              <span>{{
                scope.row.is_proprietor == 1 ? "业主" : "经纪人"
              }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="ctime" align="center" label="房源类型">
            <template slot-scope="scope">
              <span>{{
                scope.row.type == 1
                  ? "商铺转让"
                  : scope.row.type == 2
                  ? "商铺租赁"
                  : scope.row.type == 3
                  ? "写字楼租赁"
                  : "住宅租赁"
              }}</span>
            </template>
          </el-table-column>

          <el-table-column prop="status" align="center" label="审核状态">
            <template slot-scope="scope">
              <span>{{
                scope.row.status == 1
                  ? "未审核"
                  : scope.row.status == 2
                  ? "审核成功"
                  : "审核失败"
              }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="is_up" align="center" label="上下架状态">
            <template slot-scope="scope">
              <span>{{ scope.row.is_up == 1 ? "上架" : "下架" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="240">
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.status == 2 && scope.row.is_up == 2"
                type="success"
                size="mini"
                @click="handleEdit(scope.row)"
                >上架</el-button
              >
              <el-button
                v-if="scope.row.status == 2 && scope.row.is_up == 1"
                type="warning"
                size="mini"
                @click="handleEdit(scope.row)"
                >下架</el-button
              >
              <el-button
                v-if="scope.row.status == 1"
                type="success"
                size="mini"
                @click="handleEdit1(scope.row)"
                >同意</el-button
              >
              <el-button
                v-if="scope.row.status == 1"
                type="warning"
                size="mini"
                @click="handleEdit2(scope.row)"
                >驳回</el-button
              >
              <el-button
                type="primary"
                size="mini"
                @click="handleDelete(scope.row)"
                >查看</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </el-tabs>

      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page"
        :page-sizes="[10, 100, 200, 300]"
        :page-size="10"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
    <el-dialog
      :visible.sync="dialogVisible"
      width="60%"
      :before-close="handleClose"
    >
      <el-form
        :label-position="labelPosition"
        label-width="100px"
        :model="formLabelAlign"
      >
        <div>
          <p>图片</p>
          <!-- <el-image
            class="imgBox"
            v-for="item in formLabelAlign.imgs"
            :key="item"
            style="width: 80px; height: 80px"
            :src="'https://bjsf.bjsky.top' + item"
            fit="cover"
          ></el-image> -->
          <el-form-item label="门头图">
            <el-image
              class="imgBox"
              v-for="item in formLabelAlign.door_head_img"
              :key="item"
              style="width: 80px; height: 80px"
              :src="imgHeader + item"
              fit="cover"
            ></el-image>
          </el-form-item>
          <el-form-item label="室内图">
            <el-image
              class="imgBox"
              v-for="item in formLabelAlign.Indoor_img"
              :key="item"
              style="width: 80px; height: 80px"
              :src="imgHeader + item"
              fit="cover"
            ></el-image>
          </el-form-item>
          <el-form-item label="其他">
            <el-image
              class="imgBox"
              v-for="item in formLabelAlign.other_img"
              :key="item"
              style="width: 80px; height: 80px"
              :src="imgHeader + item"
              fit="cover"
            ></el-image>
          </el-form-item>
        </div>
        <div>
          <p>基本信息</p>
          <span v-if="formLabelAlign.type == 2">
            <div class="within">
              <el-form-item label="房源标题">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.housing_source_title"
                  placeholder="请输入房源标题"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="区域">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.region_name"
                  placeholder="请输入所在区域"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="商铺地址">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.address"
                  placeholder="请输入商铺地址"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="楼层房号">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.room_number"
                  placeholder="请输入楼层房号"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="商铺类型">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.HousingShopType[0].name"
                  placeholder="请输入商铺类型"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="建筑面积">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_area"
                  placeholder="请输入建筑面积"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="经营状态">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.management_status_text"
                  placeholder="请输入经营状态"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="适合业态">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.HousingIndustry[0].nameText"
                  placeholder="请输入适合业态"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="租金">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_rent"
                  placeholder="请输入租金"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <!-- mode_detain_pay -->
              <el-form-item label="押付方式">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.mode_detain_pay"
                  placeholder="请输入押付方式"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="电费">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.electricity_charge"
                  placeholder="请输入电费"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="水费">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.water_charge"
                  placeholder="请输入水费"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="起租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.start_month"
                  placeholder="请输入起租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="免租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.exempt_month"
                  placeholder="请输入免租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="客流人群">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.passenger_flow_crowd_text"
                  placeholder="请输入客流人群"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="是否临街">
                <el-radio-group v-model="formLabelAlign.facing_street">
                  <el-radio :disabled="disabled" :label="1">是</el-radio>
                  <el-radio :disabled="disabled" :label="2">否</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="面宽">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.width_building_area"
                  placeholder="请输入面宽"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="层高">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.building_floor_height"
                  placeholder="请输入层高"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="进深">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.building_depth"
                  placeholder="请输入进深"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="朝向">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.towards"
                  placeholder="请输入房源朝向"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item
                label="地铁站"
                v-if="formLabelAlign.MetroStation[0]"
              >
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.MetroStation[0].station"
                  placeholder="请输入地铁站"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
          </span>
          <span v-if="formLabelAlign.type == 3">
            <div class="within">
              <el-form-item label="房源标题">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.housing_source_title"
                  placeholder="请输入房源标题"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="区域">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.region_name"
                  placeholder="请输入所在区域"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="写字楼地址">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.address"
                  placeholder="请输入写字楼地址"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="楼层房号">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.room_number"
                  placeholder="请输入楼层房号"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="写字楼类型">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.HousingShopType[0].name"
                  placeholder="请输入写字楼类型"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="写字楼装修">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.office_building"
                  placeholder="请输入写字楼装修"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="使用率" class="threeBox">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.use_area"
                  placeholder="请输入使用率"
                  class="wiIndex"
                ></el-input>
                <span class="percentage">%</span>
              </el-form-item>

              <el-form-item label="建筑面积">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_area"
                  placeholder="请输入建筑面积"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="工位">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.work_station"
                  placeholder="请输入工位"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="租金">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_rent"
                  placeholder="请输入租金"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="押付方式">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.mode_detain_pay"
                  placeholder="请输入押付方式"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="可否注册">
                <el-radio-group v-model="formLabelAlign.is_register_num">
                  <el-radio :disabled="disabled" :label="1">是</el-radio>
                  <el-radio :disabled="disabled" :label="2">否</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="起租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.start_month"
                  placeholder="请输入起租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="免租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.exempt_month"
                  placeholder="请输入免租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="可否分割">
                <el-radio-group v-model="formLabelAlign.split_up_num">
                  <el-radio :disabled="disabled" :label="1">是</el-radio>
                  <el-radio :disabled="disabled" :label="2">否</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="性质">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.office_nature"
                  placeholder="请输入性质"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="朝向">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.towards"
                  placeholder="请输入房源朝向"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item
                label="地铁站"
                v-if="formLabelAlign.MetroStation[0]"
              >
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.MetroStation[0].station"
                  placeholder="请输入地铁站"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
          </span>
          <span v-if="formLabelAlign.type == 1">
            <div class="within">
              <el-form-item label="房源标题">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.housing_source_title"
                  placeholder="请输入房源标题"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="区域">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.region_name"
                  placeholder="请输入区域"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="朝向">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.towards"
                  placeholder="请输入房源朝向"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="商铺地址">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.address"
                  placeholder="请输入商铺地址"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="商铺类型">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.HousingShopType[0].name"
                  placeholder="请输入商铺类型"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="适合业态">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.HousingIndustry[0].nameText"
                  placeholder="请输入适合业态"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="建筑面积">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_area"
                  placeholder="请输入建筑面积"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="租金">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_rent"
                  placeholder="请输入租金"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="剩余租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.remaining_lease_term"
                  placeholder="请输入剩余租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="转让费">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.transfer_fee"
                  placeholder="请输入转让费"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="客流人群">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.passenger_flow_crowd_text"
                  placeholder="请输入客流人群"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item
                label="地铁站"
                v-if="formLabelAlign.MetroStation[0]"
              >
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.MetroStation[0].station"
                  placeholder="请输入地铁站"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
          </span>
          <span v-if="formLabelAlign.type == 4">
            <div class="within">
              <el-form-item label="房源标题">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.housing_source_title"
                  placeholder="请输入房源标题"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="朝向">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.towards"
                  placeholder="请输入房源朝向"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="区域">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.region_name"
                  placeholder="请输入所在区域"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="建筑面积">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_area"
                  placeholder="请输入建筑面积"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="住宅地址">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.address"
                  placeholder="请输入住宅地址"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="住宅层高">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.residential"
                  placeholder="请输入住宅层高"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="房型住宅">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.housingType"
                  placeholder="请输入房型住宅"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="套型分类">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.jacketedType"
                  placeholder="请输入套型分类"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="租金">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.architecture_rent"
                  placeholder="请输入租金"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="押付方式">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.mode_detain_pay"
                  placeholder="请输入押付方式"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="起租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.start_month"
                  placeholder="请输入起租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="免租期">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.exempt_month"
                  placeholder="请输入免租期"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item label="电费">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.electricity_charge"
                  placeholder="请输入电费"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
              <el-form-item label="水费">
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.water_charge"
                  placeholder="请输入水费"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
            <div class="within">
              <el-form-item
                label="地铁站"
                v-if="formLabelAlign.MetroStation[0]"
              >
                <el-input
                  :disabled="disabled"
                  v-model="formLabelAlign.MetroStation[0].station"
                  placeholder="请输入地铁站"
                  class="wiIndex"
                ></el-input>
              </el-form-item>
            </div>
          </span>
        </div>
        <div>
          <p>配套设施</p>
          <!-- formLabelAlign.supportingFacilities[index].name -->
          <span
            v-for="item in formLabelAlign.supportingFacilities"
            :key="item"
            >{{ item }}</span
          >
        </div>
        <div class="houseTag">
          <p>房源标签</p>
          <span v-for="item in formLabelAlign.propertyTags" :key="item">{{
            item
          }}</span>
        </div>
        <div class="houseInfo">
          <p>房源信息</p>
          <!-- <div class="within">
            <el-form-item label="房源标题">
              <el-input
                :disabled="disabled"
                v-model="formLabelAlign.housing_source_title"
                placeholder="请输入房源标题"
                class="wiIndex"
              ></el-input>
            </el-form-item>
          </div> -->
          <div>
            <el-form-item label="房源介绍">
              <el-input
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 10 }"
                :disabled="disabled"
                v-model="formLabelAlign.Introduction"
                placeholder="请输入房源介绍"
                class="wiIndex"
              ></el-input>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="房产证" v-if="formLabelAlign.type != 1">
              <el-image
                style="width: 200px; height: 120px"
                :src="imgHeader + formLabelAlign.real_estate_certificate"
                fit="cover"
              ></el-image>
            </el-form-item>
          </div>
        </div>

        <div>
          <p>联系人</p>
          <div class="within">
            <el-form-item label="联系人">
              <el-input
                :disabled="disabled"
                v-model="formLabelAlign.name"
                placeholder="请输入联系人"
                class="wiIndex"
              ></el-input>
            </el-form-item>
          </div>
          <div class="within">
            <el-form-item label="手机号">
              <el-input
                :disabled="disabled"
                v-model="formLabelAlign.phone"
                placeholder="请输入手机号"
                class="wiIndex"
              ></el-input>
            </el-form-item>
          </div>
          <div class="within">
            <el-form-item label="性别">
              <el-input
                :disabled="disabled"
                v-model="formLabelAlign.gender_text"
                placeholder="请输入性别"
                class="wiIndex"
              ></el-input>
            </el-form-item>
          </div>
        </div>
        <div class="btnBox">
          <el-button
            type="danger"
            v-if="formLabelAlign1.sttus == 1"
            @click="handleEdit2(scope.row)"
            >拒绝</el-button
          >
          <el-button
            type="success"
            v-if="formLabelAlign1.sttus == 1"
            @click="handleEdit1(scope.row)"
            >同意</el-button
          >
          <el-button type="primary" @click="handleBack">返回</el-button>
        </div>
      </el-form>
    </el-dialog>
  </el-card>
</template>

<script>
import {
  getHouseList,
  getHouseListStatus,
  getHouseListDetail,
  getsupportingFacilities,
  getPropertyTags,
  getBusinessFormat,
} from "../../../../utils/main";
export default {
  data() {
    return {
      imgHeader: this.Global.imgHeader,

      options: [
        {
          id: "1",
          name: "材料费+工时费",
        },
        {
          id: "2",
          name: "工时费",
        },
      ],
      optionsType: [
        {
          id: "1",
          name: "商铺转让",
        },
        {
          id: "2",
          name: "商铺租赁",
        },
        {
          id: "3",
          name: "写字楼租赁",
        },
        {
          id: "4",
          name: "住宅租赁",
        },
      ],
      optionsStatus: [
        {
          id: 1,
          name: "上架",
        },
        {
          id: 2,
          name: "下架",
        },
        {
          id: 3,
          name: "同意",
        },
        {
          id: 4,
          name: "驳回",
        },
      ],
      labelPosition: "right",
      value: "",
      formInline: {
        housing_source_title: "",
        name: "",
        phone: "",
        type: "",
      },
      formLabelAlign: {
        name: "",
      },
      // titleText: "新增工种",
      disabled: true,
      loading: false,
      token: sessionStorage.getItem("token"),
      dialogVisible: false,
      propertyTags: [],
      supportingFacilities: [],
      tableData: [],
      formLabelAlign1: {},
      list: [],
      radio: 2,
      //当前页数
      page: 1,
      limit: 10,
      total: 0,
      currentPage: 1,
      state: "",
      status: "",
      is_up: "",
      name: "",
      // 1是业主，2是经纪人
      is_proprietor: 1,
      rules: {
        name: [{ required: true, message: "请输入工种", trigger: "blur" }],
      },
    };
  },
  methods: {
    stateChange() {
      // 上架
      if (this.state == 1) {
        this.is_up = 1;
        this.status = "";
      }
      // 下架
      if (this.state == 2) {
        this.is_up = 2;
        this.status = "";
      }
      // 同意
      if (this.state == 3) {
        this.status = 2;
        this.is_up = "";
      }
      // 拒绝
      if (this.state == 4) {
        this.status = 3;
        this.is_up = "";
      }
      console.log(this.is_up, this.status);
    },
    handleClick(tab, event) {
      if (tab.index == 0) {
        (this.page = 1), (this.is_proprietor = 1), this.getList();
        console.log("业主");
      } else {
        (this.page = 1), (this.is_proprietor = 2), this.getList();
        console.log("经纪人");
      }
    },
    // 启用禁用接口
    conditionUser(id, status, is_up) {
      getHouseListStatus(this.token, id, status, is_up)
        .then((res) => {
          if (res.data.status) {
            this.getList();
          } else {
            if (res.data.msg == "token失效,请重新进行登录") {
              this.$router.push("/login");
            }
            if (res.data.msg == "此账号没有权限") {
              this.$message.error(res.data.msg);
              this.loading = false;
            }
            let timer = setTimeout(() => {
              this.$message.error(res.data.msg);
            }, 1000);
          }
        })
        .catch((err) => {
          console.log(err.message);
        });
    },

    // 获取房源管理列表
    async getList() {
      this.loading = true;
      let res = await getHouseList(
        this.token,
        "",
        this.formInline.housing_source_title,
        this.formInline.name,
        this.formInline.phone,
        this.formInline.type,
        this.is_proprietor,
        this.status,
        this.is_up,
        this.page,
        this.limit
      );
      if (res.data.status) {
        this.tableData = res.data.data.data || [];
        this.total = res.data.data.count;
        let timer = setTimeout(() => {
          this.loading = false;
          clearTimeout(timer);
        }, 400);
      } else {
        if (res.data.msg == "token失效,请重新进行登录") {
          this.$router.push("/login");
        }
        if (res.data.msg == "此账号没有权限") {
          this.$message.error(res.data.msg);
          this.loading = false;
        }
        let timer = setTimeout(() => {
          this.$message.error(res.data.msg);
        }, 5000);
      }
    },
    getParentId(list, pid) {
      for (let item of list || []) {
        if (item.id == pid) return item.name;
      }
    },
    goodsSonSort(token, page, limit, id) {
      this.loading = true;
      getBusinessFormat(token, page, limit, id).then((res) => {
        if (res.data.status) {
          this.list = res.data.data.data;
          // this.total = res.data.data.count;
          let timer = setTimeout(() => {
            this.loading = false;
            clearTimeout(timer);
          }, 400);
        } else {
          if (res.data.msg == "token失效,请重新进行登录") {
            this.$router.push("/login");
          }
          this.$message.error(res.data.msg);
          this.loading = false;
        }
      });
    },
    // 获取房源管理列表详情
    async getListDetail() {
      // this.loading = true;
      let res = await getHouseListDetail(this.token, this.formLabelAlign1.id);
      if (res.data.status) {
        this.formLabelAlign = res.data.data || {};
        if (this.formLabelAlign.type == 4) {
          this.formLabelAlign.jacketedType =
            res.data.data.room_suit +
            "室" +
            res.data.data.office +
            "厅" +
            res.data.data.lavatory +
            "卫";
          if (res.data.data.shop_type == 1) {
            this.formLabelAlign.housingType = "单元式住宅";
          } else if (res.data.data.shop_type == 2) {
            this.formLabelAlign.housingType = "公寓式住宅";
          } else if (res.data.data.shop_type == 3) {
            this.formLabelAlign.housingType = "复式住宅";
          } else if (res.data.data.shop_type == 4) {
            this.formLabelAlign.housingType = "跃层式住宅";
          } else if (res.data.data.shop_type == 5) {
            this.formLabelAlign.housingType = "花园洋房式住宅";
          } else if (res.data.data.shop_type == 6) {
            this.formLabelAlign.housingType = "别墅";
          }
        }

        if (this.formLabelAlign.HousingIndustry.length > 0) {
          let name = this.getParentId(
            this.list,
            this.formLabelAlign.HousingIndustry[0].pid
          );
          this.formLabelAlign.HousingIndustry[0].nameText =
            name + " - " + this.formLabelAlign.HousingIndustry[0].name;
          console.log("name", name);
        }

        // 图片
        // let imgArray = [];
        this.formLabelAlign.Indoor_img =
          this.formLabelAlign.housing_source_Indoor_img.split(",");
        this.formLabelAlign.door_head_img =
          this.formLabelAlign.housing_source_door_head_img.split(",");
        this.formLabelAlign.other_img =
          this.formLabelAlign.housing_source_other_img.split(",");

        // this.formLabelAlign.imgs = imgArray;
        // console.log(imgArray);
        // 押付方式
        this.formLabelAlign.mode_detain_pay =
          "押" +
          this.formLabelAlign.mode_detain +
          "付" +
          this.formLabelAlign.mode_pay;
        // 判断客流人群
        if (this.formLabelAlign.passenger_flow_crowd != null) {
          let flowCrowd = this.formLabelAlign.passenger_flow_crowd
            .split(",")
            .map(Number);
          console.log(this.formLabelAlign.passenger_flow_crowd);
          let flow_crowd_text = "";
          flowCrowd.forEach((item) => {
            item == 1
              ? (item = "办公人群")
              : item == 2
              ? (item = "旅游人群")
              : item == 3
              ? (item = "居民人群")
              : item == 4
              ? (item = "学生人群")
              : item == 5
              ? (item = "其他")
              : "";
            flow_crowd_text += item + " ";
          });
          this.formLabelAlign.passenger_flow_crowd_text = flow_crowd_text;
        } else {
          this.formLabelAlign.passenger_flow_crowd_text = "";
        }
        // console.log(this.formLabelAlign.passenger_flow_crowd_text);
        // 判断性别
        if (this.formLabelAlign.gender == 1) {
          this.formLabelAlign.gender_text = "男";
        } else {
          this.formLabelAlign.gender_text = "女";
        }
        // 判断经营状态
        if (this.formLabelAlign.management_status == 1) {
          this.formLabelAlign.management_status_text = "经营中";
        } else {
          this.formLabelAlign.management_status_text = "空置";
        }
        this.formLabelAlign.is_register_num = Number(
          this.formLabelAlign.is_register
        );
        this.formLabelAlign.split_up_num = Number(this.formLabelAlign.split_up);
        // 配置设套
        let newArr = [];
        let arr1 = this.formLabelAlign.HousingMatchingSourceAssociation;
        console.log("arr1", arr1);
        let arr2 = this.supportingFacilities;
        console.log("arr2", arr2);
        const result = arr2
          .filter((item1) =>
            arr1.some((item2) => item1.id == item2.matching_setting_id)
          )
          .map((item) => item.name);
        this.formLabelAlign.supportingFacilities = result;
        // for (let i = 0; i < arr2.length; i++) {
        //   for (let j = 0; j < arr1.length; j++) {
        //     if (arr1[j].matching_setting_id == arr2[i].id) {
        //       newArr.push(arr2[i].name);
        //     }
        //   }
        // }
        // this.formLabelAlign.supportingFacilities = newArr;

        // console.log("arr", this.formLabelAlign.supportingFacilities);
        // 房源标签
        let newArr2 = [];
        let arr3 = this.formLabelAlign.HousingHousingLabelAssociation;
        let arr4 = this.propertyTags;
        for (let i = 0; i < arr3.length; i++) {
          for (let j = 0; j < arr4.length; j++) {
            if (arr3[i].housing_label_id == arr4[j].id) {
              newArr2.push(arr4[j].name);
            }
          }
        }
        this.formLabelAlign.propertyTags = newArr2;
        console.log("arr2", this.formLabelAlign.propertyTags);

        let timer = setTimeout(() => {
          this.loading = false;
          clearTimeout(timer);
        }, 400);
      } else {
        if (res.data.msg == "token失效,请重新进行登录") {
          this.$router.push("/login");
        }
        if (res.data.msg == "此账号没有权限") {
          this.$message.error(res.data.msg);
          this.loading = false;
        }
        let timer = setTimeout(() => {
          this.$message.error(res.data.msg);
        }, 5000);
      }
    },
    // 配套设施
    async getHouseSupportingFacilities() {
      let res = await getsupportingFacilities(this.token, "", 1, 100);
      if (res.data.status) {
        this.supportingFacilities = res.data.data.data || [];
      } else {
        if (res.data.msg == "token失效,请重新进行登录") {
          this.$router.push("/login");
        }
        if (res.data.msg == "此账号没有权限") {
          this.$message.error(res.data.msg);
          this.loading = false;
        }
        let timer = setTimeout(() => {
          this.$message.error(res.data.msg);
        }, 5000);
      }
    },
    // 房源标签
    async getHousePropertyTags() {
      // this.loading = true;
      let res = await getPropertyTags(this.token, "", 1, 100);
      if (res.data.status) {
        this.propertyTags = res.data.data.data || [];
      } else {
        if (res.data.msg == "token失效,请重新进行登录") {
          this.$router.push("/login");
        }
        if (res.data.msg == "此账号没有权限") {
          this.$message.error(res.data.msg);
          this.loading = false;
        }
        let timer = setTimeout(() => {
          this.$message.error(res.data.msg);
        }, 5000);
      }
    },

    search() {
      // this.name = this.formInline.name;
      this.page = 1;
      this.getList();
    },
    resert() {
      this.formInline = {
        housing_source_title: "",
        name: "",
        phone: "",
        type: "",
      };
      this.state = "";
      this.status = "";
      this.is_up = "";
      this.getList();
    },
    // 上下架
    handleEdit(row) {
      if (row.is_up == 2) {
        let is_up = 1;
        this.conditionUser(row.id, "", is_up);
      }
      if (row.is_up == 1) {
        let is_up = 2;
        this.conditionUser(row.id, "", is_up);
      }
    },
    // 同意
    handleEdit1(row) {
      // 1是未审核，2是同意，审核成功，3是驳回，审核失败
      // if (row.status == 1) {
      //   let status = 2;
      //   this.conditionUser(row.id, status, "");
      // }
      let status = 2;
      this.conditionUser(row.id, status, "");
    },
    // 驳回
    handleEdit2(row) {
      let status = 3;
      this.conditionUser(row.id, status, "");
    },
    handleBack() {
      this.dialogVisible = false;
    },
    // 详情
    handleDelete(row) {
      let obj = JSON.parse(JSON.stringify(row));
      this.formLabelAlign1 = obj;
      this.dialogVisible = true;
      this.getListDetail();
    },

    // 排序
    indexMethod(index) {
      if (this.total < this.limit) {
        return this.total - index;
      } else {
        return this.total - (this.page - 1) * this.limit - index;
      }
    },

    //关闭
    handleClose() {
      // this.$refs.form.resetFields();
      this.dialogVisible = false;
    },

    //页数
    handleSizeChange(val) {
      this.limit = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.page = val;
      this.getList();
    },
  },
  mounted() {
    this.getList();
    this.getHouseSupportingFacilities();
    this.getHousePropertyTags();
    this.goodsSonSort(this.token, 1, 100, 0);
  },
};
</script>

<style scoped>
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both;
}

.box-card {
  width: 100%;
}

.imageGood {
  margin: 0 10px;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}

.divWidth {
  width: 70%;
}
.btnBox {
  display: flex;
  justify-content: center;
}
.btnBox {
  display: flex;
  justify-content: center;
}
.within {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
}

.within .el-form-item {
  width: 45%;
}
.imgBox {
  margin-right: 50px;
  margin-bottom: 10px;
}
span {
  margin-left: 15px;
}
p {
  font-size: 18px;
  margin-bottom: 10px;
}
.houseInfo {
  margin-top: 15px;
}
.houseTag {
  margin-top: 15px;
}
.threeBox {
  position: relative;
}
.percentage {
  position: absolute;
  right: -15px;
}
</style>